﻿using UnityEngine;
using System.Collections;
using System.Xml;
using System.IO;

public class SampleXml : MonoBehaviour {

	XmlDocument xmlDoc = new XmlDocument ();
	TextAsset rscTextAsset;
	public static ArrayList prefabPath = new ArrayList();

	void Awake()
	{
		rscTextAsset = Resources.Load ("XML/Path", typeof(TextAsset)) as TextAsset;
		resolveXML("name");
	}

	void Start () {
	   
	}

	void Update () {
	
	}

	protected void resolveXML(string name)
	{
		string str_Path=null;
		if (rscTextAsset != null) 
        {
			xmlDoc.Load (new MemoryStream (rscTextAsset.bytes));
			XmlNode rootNode = xmlDoc.FirstChild;
			if (rootNode.Name == "something") 
			{
				int rscCount = rootNode.ChildNodes.Count;
				for (int n=0; n<rscCount; n++) 
				{
					for (int m=0; m<rootNode.ChildNodes[n].Attributes.Count; m++) 
					{
						XmlAttribute attr = rootNode.ChildNodes [n].Attributes [m];
						if (attr.Name == "name") 
						{
							prefabPath.Add(attr.Value);
						}
					}
				}
			}
		}
	}
}
